import Vue from 'vue';
import VueRouter from 'vue-router';
import UserForm from "../views/layout/main/user/UserForm";
import ClientForm from "../views/layout/main/client/ClientForm";
import ProductForm from "../views/layout/main/product/ProductForm";
import OrdersForm from "../views/layout/main/orders/OrdersForm";
import Label from "../views/layout/main/label/LabelForm";
import OrganizationalStructure from "../views/layout/main/organizationalStructure/OrganizationalStructure";
import Index from "../views/Index"
import Login from "../views/Login";
import Home from "../views/layout/main/home/Home";
Vue.use(VueRouter)


const  routes =[
  {
    path: '/',
    redirect: '/login'
  },
  // 主要路由
  {
    path:'/main',
    name: 'main',
    component: Index,
    // 二级路由
    children: [
          {
            path: 'home',
            component: Home,
          },
          {
            path: 'user-management',
            component: UserForm,
          },
          {
            path: 'client-management',
            component: ClientForm,
          },
          {
            path: 'product-management',
            component: ProductForm,
          },
          {
            path: 'orders-management',
            component: OrdersForm,
          },
          {
            path: 'label-management',
            component: Label,
          },
          {
            path: 'structure',
            component: OrganizationalStructure,
          },
      ],
  },
  {
    path: '/login',
    component: Login,
  },
  {
    path: '*',
    name: 'Error404',
    component: () => import(/* webpackChunkName: "error404" */ "../views/Error404"),
  }
]

const router = new VueRouter({
  mode: 'history', // 使用history模式
  routes
})

export default router


